home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club (Business) 1997 July / Software of the Month Club - Business (Volume 239) (July 1997).iso / pc / code / d.dxr / 00008_D enviro Handlers.ls < prev    next >
Encoding:
Text File  |  1996-02-15  |  4.2 KB  |  183 lines

  1. global HARP, TIGO, HORN, DRUM, CHIME, BASS, sPALETTE, gObjects, gOBJECTSD, gWorld, gPuppetlines, gLastKeyList, gNotes, gNextEnvLetter, gNextDIRFile, gMIDIPlayTRUE, gInitalized, noteObjs, windowsMIDIXObj, xNAVXOBJ, xCURXOBJ, gCPU, gFileSep, gRootPath, gHDpath, gXobjs, gXOBJPath, gCDpath, gCDName
  2.  
  3. on InitEnviromentObjects
  4.   set sPALETTE to 2
  5.   set gOBJECTSD to [:]
  6.   INITintruments()
  7.   InitMixer()
  8.   InitJukeBox()
  9.   ProcessCastObjects(gOBJECTSD)
  10.   sort(gObjects)
  11. end
  12.  
  13. on PlayMusic INTRument
  14. end
  15.  
  16. on PlaytheNote INTRument
  17.   set OBj to getaProp(gObjects, INTRument)
  18.   set note to getRandomNote(DRUM, 3, 8)
  19.   noteOn(INTRument, note, 127)
  20.   repeat while the mouseDown
  21.     CursorandUpdate()
  22.   end repeat
  23.   noteOff(INTRument, note)
  24. end
  25.  
  26. on PlayNoteFromHitMap INTRument
  27.   set OBj to getaProp(gObjects, INTRument)
  28.   set lastNoteTime to the ticks - 10
  29.   repeat while the mouseDown
  30.     if the ticks < (lastNoteTime + 5) then
  31.       next repeat
  32.     end if
  33.     set note to xCURXOBJ(mWhere, the mouseH, the mouseV)
  34.     if note > 0 then
  35.       if note > 127 then
  36.         set note to note / 2
  37.       end if
  38.       noteOn(INTRument, note, 127)
  39.       set duration to random(30)
  40.       set start to the ticks
  41.       repeat while the ticks < (start + duration)
  42.         CursorandUpdate()
  43.       end repeat
  44.       noteOff(INTRument, note)
  45.       set lastNoteTime to the ticks
  46.     end if
  47.   end repeat
  48. end
  49.  
  50. on LoadChoaticHitMap INTRument
  51.   set Mapref to string(INTRument & "Map")
  52.   set pathName to string(gCDName & "CODE" & gFileSep & Mapref & ".BMP")
  53.   set xCURXOBJ to OffScreen(mnew, pathName, 0, 0, 4)
  54. end
  55.  
  56. on playDJVO
  57.   playSound("D07DJaa.aif", #keyframeFile, 1)
  58. end
  59.  
  60. on EnterD04
  61.   if voidp(getaProp(getaProp(gStates, #BeenThere), #d04)) then
  62.     Startthetimer(1, "playDJVO")
  63.     PDARelease("J05rad.mov")
  64.   end if
  65.   if not voidp(gLastKeyList) then
  66.     if char 1 of string(getaProp(gLastKeyList, #RefName)) <> "D" then
  67.       MakeDynamic(#DJVid, #newhit, #enter)
  68.       InitMidiGlobals()
  69.     end if
  70.   else
  71.     MakeDynamic(#DJVid, #newhit, #enter)
  72.     InitMidiGlobals()
  73.   end if
  74. end
  75.  
  76. on UnLoadChoaticHitMap
  77.   xCURXOBJ(mdispose)
  78. end
  79.  
  80. on Entertimur
  81.   LoadChoaticHitMap(#timur)
  82. end
  83.  
  84. on Exittimur
  85.   UnLoadChoaticHitMap()
  86. end
  87.  
  88. on EnterHarp
  89.   LoadChoaticHitMap(#HARP)
  90. end
  91.  
  92. on ExitHarp
  93.   UnLoadChoaticHitMap()
  94. end
  95.  
  96. on EnterBAss
  97.   if getaProp(getaProp(gObjects, #BASS), #State) = #nonChaotic then
  98.     set pathName to string(gCDName & "CODE" & gFileSep & "BASSLine.BMP")
  99.     set xCURXOBJ to OffScreen(mnew, pathName, 0, 0, 1)
  100.   else
  101.     if getaProp(getaProp(gObjects, #BASS), #State) = #Chaotic then
  102.       LoadChoaticHitMap(#BASS)
  103.     end if
  104.   end if
  105. end
  106.  
  107. on ExitBAss
  108.   if getaProp(getaProp(gObjects, #BASS), #State) = #nonChaotic then
  109.     UnLoadChoaticHitMap()
  110.   else
  111.     if getaProp(getaProp(gObjects, #BASS), #State) = #Chaotic then
  112.       UnLoadChoaticHitMap()
  113.     end if
  114.   end if
  115. end
  116.  
  117. on EnterHorn
  118.   LoadChoaticHitMap(#HORN)
  119. end
  120.  
  121. on ExitHorn
  122.   UnLoadChoaticHitMap()
  123. end
  124.  
  125. on EnterDrum
  126.   LoadChoaticHitMap(#DRUM)
  127. end
  128.  
  129. on ExitDrum
  130.   UnLoadChoaticHitMap()
  131. end
  132.  
  133. on EnterChime
  134.   LoadChoaticHitMap(#CHIME)
  135. end
  136.  
  137. on ExitChime
  138.   UnLoadChoaticHitMap()
  139. end
  140.  
  141. on EnterMixer
  142.   set this to Startthetimer(1, "IntruDetails")
  143.   if getaProp(getaProp(gStates, #BeenThere), #D22) = 1 then
  144.   end if
  145.   MakeDynamic(#MIXER, #DisplayState, #false)
  146. end
  147.  
  148. on ExitMixer
  149.   StopPlayMixer()
  150.   stopPlayAllTracks()
  151.   DelObjects([#MIXER])
  152. end
  153.  
  154. on EnterJukeBox
  155. end
  156.  
  157. on ExitJukeBox
  158. end
  159.  
  160. on EnterD23
  161.   if getaProp(getaProp(gStates, #Conditions), #radioStation) >= 1 then
  162.     MakeDynamic(#WinDJCARtoE, #State, #Win)
  163.     PDARelease("J04m14p.mov")
  164.   end if
  165. end
  166.  
  167. on doExitD22
  168.   genexitkf(#D11)
  169. end
  170.  
  171. on DoPointcombo
  172.   set pointSet to [#T: point(233, 6), #BL: point(249, 286), #BR: point(299, 279), 1: point(169, 176), 2: point(145, 249), 3: point(388, 211), 4: point(347, 150)]
  173.   set pointSet2 to [#T: point(233, 6), #BL: point(249, 286), #BR: point(299, 279), 1: point(169, 176), 2: point(145, 249), 3: point(388, 211), 4: point(347, 150)]
  174.   repeat with Y in pointSet2
  175.     set outlist to [:]
  176.     repeat with X = 1 to count(pointSet)
  177.       set aname to value("#" & getPropAt(pointSet, X))
  178.       set arect to rect(the locH of Y, the locV of Y, the locH of getAt(pointSet, X), the locV of getAt(pointSet, X))
  179.       setaProp(outlist, aname, arect)
  180.     end repeat
  181.   end repeat
  182. end
  183.